package edu.scdx.service;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.scdx.dao.UserInfoMapper;
import edu.scdx.dao.OrderMapper;
import edu.scdx.entity.UserInfo;
import edu.scdx.entity.Order;

@Service
public class OrderServiceImpl implements OrderService{

	@Autowired
    private OrderMapper orderMapper;

	public OrderMapper getOrderMapper() {
		return orderMapper;
	}

	public void setOrderMapper(OrderMapper orderMapper) {
		this.orderMapper = orderMapper;
	}

	@Override
	public void addOrder(String userTel, int id, String name, String type, String author, String publisher,
			String description, double price, double kou, Integer state, Integer comment) {
		orderMapper.addOrder(userTel, id, name,type,author,publisher,description,price,kou,state,comment);
		
	}

	@Override
	public List<Order> getOrderByState(String userTel, Integer state) {
		
		return orderMapper.getOrderByState(userTel,state);
		
	}

	@Override
	public List<Order> getOrderByComment(String userTel, Integer comment) {
		
		return orderMapper.getOrderByComment(userTel,comment);
		
	}

	@Override
	public void deleteOrder(String userTel, Integer id) {
		
		orderMapper.deleteOrder(userTel,id);
		
	}

	@Override
	public void updateComment(String userTel, Integer id,Integer add) {
		
		orderMapper.updateComment(userTel,id,add);
		
	}

	@Override
	public List<Order> getAllNotSold(Integer state) {
		
		return orderMapper.getAllNotSold(state);
		
	}

	@Override
	public void updateState(String tel, Integer id, Integer state) {
		
		orderMapper.updateState(tel,id,state);
		
	}

	
	
	
	
	
}
